package com.wiscamp.ninechapters.problems.infrastructure.converters;

import com.wiscamp.ninechapters.problems.domain.models.exams.Exam;
import com.wiscamp.ninechapters.problems.infrastructure.po.exams.ExamPO;
import com.wiscamp.ninechapters.problems.infrastructure.po.exams.ExamView;
import org.mapstruct.Mapper;
import org.mapstruct.MappingTarget;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

@Mapper(componentModel = "spring",
        unmappedTargetPolicy = ReportingPolicy.IGNORE,
        unmappedSourcePolicy = ReportingPolicy.IGNORE,
        nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
public interface ExamConverter {
    ExamConverter Instance = Mappers.getMapper(ExamConverter.class);

    ExamPO toExamPO(Exam entity);

    ExamPO toExamPO(Exam entity, @MappingTarget ExamPO po);

    Exam toExam(ExamPO po);

    Exam toExamByView(ExamView view);
}
